# -*- coding: utf-8 -*-

# $Id: utils.py 2 2012-09-01 15:54:17Z alexis.roda.villalonga@gmail.com $


def uncamelize(string, sep="_"):
    """Uncamelizes an string

    :param string:
    :param sep:

    :raises:
    :returns: uncamelized version
    :rtype: str/unicode
    """
    res = []
    for i, c in enumerate(string):
        if c.isupper():
            if i > 0:
                res.append(sep)
            res.append(c.lower())
        else:
            res.append(c)
    return "".join(res)
